#include<conio.h>
#include<stdio.h>
#include<graphics.h>

int main()
{
	initgraph(1600,800);//打开一个窗口
	setlinecolor(RED);
	int step=1;
	COLORREF color;
	float pi=3.14159;
	initgraph(1200,800);//打开一个窗口
	setbkcolor(RGB(128,128,128));
	cleardevice();
	int centerX=300;//圆心坐标
	int centerY=300;
	int radius=200;//⚪半径

    int i;
	float offset;
	float totalOffset=0;

	float h=rand()%180;
	COLORREF color1=HSVtoRGB(h,0.9,0.8);
	COLORREF color2=HSVtoRGB(h+180,0.9,0.8);
	for (centerX=100;centerX<1200;centerX=centerX+400)
	{
		for (centerY=100;centerY<1600;centerY=centerY+200)
		{
			totalOffset=0;//角度偏移量
			float h=rand()%180;//随机色调
			COLORREF color1=HSVtoRGB(h,0.9,0.8);
			COLORREF color2=HSVtoRGB(h+180,0.9,0.8);
			for (radius=100;radius>0;radius=radius-20)
			{
				int left=centerX-radius;//圆外切矩形左上角x坐标
				int top=centerY-radius;//圆外切矩形右下角y坐标
				int right=centerX+radius;//圆外切矩形右下角x坐标
				int bottom=centerY+radius;//圆外切矩形左上角yzuobiao
				for (i=0;i<20;i++)
				{
					offset=i*pi/10+totalOffset;//各组扇形之间偏移的角度
					setfillcolor(color1);
					solidpie(left,top,right,bottom,offset,2*pi/60+offset);
					setfillcolor(RGB(255,255,255));//设置填充色为白色
					solidpie(left,top,right,bottom,2*pi/60+offset,3*pi/60+offset);//画填充扇形
					setfillcolor(color2);
					solidpie(left,top,right,bottom,3*pi/60+offset,5*pi/60+offset);
					setfillcolor(RGB(0,0,0));
					solidpie(left,top,right,bottom,5*pi/60+offset,6*pi/60+offset);
				}
				totalOffset = totalOffset + pi/20;
			}
		}
		_getch();
	}
	
	return 0;
}